{include file="public/header" /}



<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>基本设置</h3>
                <h5></h5>
            </div>
            {include file="public/admin_items" /}
        </div>
    </div>

    <form method="post" >
      <table class="ds-default-table">
            <thead>
            <tr class="space">
                <th colspan="16">客户端设置:</th>
            </tr>
            <tr class="thead">
                <th>{$Think.lang.points_item}</th>
                <th>赠送积分</th>
            </tr>
            </thead>
            <tbody>
            <tr class="hover">
                <td style="width: 203px;">普通客户邀请客户</td>
                <td>
                    <span style="width: 135px;" title="{$Think.lang.ds_editable}" ajax_branch="adv_branch" datatype="number" fieldid="invitation" fieldname="invitation" ds_type="inline_edit" class="editable">
<?php echo $invitation['value'];?>
                    </span>
                </td>
            </tr>
            <!-- <tr class="hover">
                <td style="width: 203px;">普通客户邀请客户</td>
                <td><input id="invitation" name="invitation" value="{$list_setting.invitation}"  class="txt" type="text" style="width:60px;">
                </td>
            </tr> -->
            <tr class="hover">
                <td class="w200">普通客户邀请服务人员</td>
                <td>
                    <span style="width: 135px;" title="{$Think.lang.ds_editable}" ajax_branch="adv_branch" datatype="number" fieldid="purchase_goods" fieldname="purchase_goods" ds_type="inline_edit" class="editable">
                        <?php echo $purchase_goods['value'];?>
                    </span>
                </td>
            </tr>
            <thead>
            <tr class="space">
                <th colspan="16">服务端设置:</th>
            </tr>
            <tr class="thead">
                <th>{$Think.lang.points_item}</th>
                <th>赠送余额</th>
            </tr>
            </thead>
            <tr class="hover">
                <td style="width: 203px;">服务人员邀请客户</td>
                <td>
                    <span style="width: 135px;" title="{$Think.lang.ds_editable}" ajax_branch="adv_branch" datatype="number" fieldid="service_balance" fieldname="service_balance" ds_type="inline_edit" class="editable">
                         <?php echo $service_balance['value'];?>
                    </span>
                </td>
            </tr>
            <tr class="hover">
                <td class="w200">服务人员邀请服务人员</td>
                <td>
                    <span style="width: 135px;" title="{$Think.lang.ds_editable}" ajax_branch="adv_branch" datatype="number" fieldid="service_invitation" fieldname="service_invitation" ds_type="inline_edit" class="editable">
                        <?php echo $service_invitation['value'];?>
                    </span>

                </td>
            </tr>


            <thead>
            <tr class="space">
                <th colspan="16">积分设置:</th>
            </tr>
            <tr class="thead">
                <th>{$Think.lang.points_item}</th>
                <th>比例</th>
            </tr>
            </thead>
            <tr class="hover">
                <td style="width: 203px;">积分数量</td>
                <td>
                    <span style="width: 135px;" title="{$Think.lang.ds_editable}" ajax_branch="adv_branch" datatype="number" fieldid="integral_ratio" fieldname="integral_ratio" ds_type="inline_edit" class="editable">
                        <?php echo $integral_ratio['value'];?>
                    </span>
                </td>
            </tr>
            <tr class="hover">
                <td style="width: 203px;">金额数量</td>
                <td>
                    <span style="width: 135px;" title="{$Think.lang.ds_editable}" ajax_branch="adv_branch" datatype="number" fieldid="price_ratio" fieldname="price_ratio" ds_type="inline_edit" class="editable">
                        <?php echo $price_ratio['value'];?>
                    </span>
                </td>
            </tr>
            </tbody>

          <thead>
          <tr class="space">
              <th colspan="16">提现设置:</th>
          </tr>
          <tr class="thead">
              <th>{$Think.lang.points_item}</th>
              <th>比例</th>
          </tr>
          </thead>
          <tr class="hover">
              <td style="width: 203px;">提现费率</td>
              <td>
                    <span style="width: 135px;" title="提现费率" ajax_branch="adv_branch" datatype="number" fieldid="service_money_radio" fieldname="service_money_radio" ds_type="inline_edit" class="editable">
                        <?php echo $service_money_radio['value'];?>
                    </span>
              </td>
          </tr>
          <thead>
          <tr class="space">
              <th colspan="16">添砖奖励设置:</th>
          </tr>
          <tr class="thead">
              <th>{$Think.lang.points_item}</th>
              <th>金额</th>
          </tr>
          </thead>
          <tr class="hover">
              <td style="width: 203px;">服务人员添砖奖励</td>
              <td>
                    <span style="width: 135px;" title="服务人员添砖奖励" ajax_branch="adv_branch" datatype="number" fieldid="service_tianzhuan_money" fieldname="service_tianzhuan_money" ds_type="inline_edit" class="editable">
                        <?php echo $service_tianzhuan_money['value'];?>
                    </span>
              </td>
          </tr>
          </tbody>
        </table>

    </form>
</div>
<script type="text/javascript" src="{$Think.ADMIN_SITE_ROOT}/js/jquery.edit.js" charset="utf-8"></script>
<link rel="stylesheet" href="{$Think.PLUGINS_SITE_ROOT}/js/jquery.lightbox/css/lightbox.min.css">
<script src="{$Think.PLUGINS_SITE_ROOT}/js/jquery.lightbox/js/lightbox.min.js"></script>
<script>

    $(document).ready(function(){
        $("#settingForm").validate({
            errorPlacement: function(error, element){
                error.appendTo(element.parent().parent().find('td:last'));
            },
            rules : {
                points_reg:{
                    number:true,
                    min:0
                },
                points_login :{
                    number:true,
                    min:0
                },
                points_comments :{
                    number:true,
                    min:0
                },
                points_signin :{
                    number:true,
                    min:0
                },
                points_invite :{
                    number:true,
                    min:0
                },
                points_rebate :{
                    number:true,
                    min:0
                },
                points_orderrate :{
                    number:true,
                    min:0
                },
                points_ordermax :{
                    number:true,
                    min:0
                }
            },
            messages : {
                points_reg:{
                    number:'{$Think.lang.ds_sort_number}',
                    min:'{$Think.lang.ds_min_error}0'
                },
                points_login :{
                    number:'{$Think.lang.ds_sort_number}',
                    min:'{$Think.lang.ds_min_error}0'
                },
                points_comments :{
                    number:'{$Think.lang.ds_sort_number}',
                    min:'{$Think.lang.ds_min_error}0'
                },
                points_signin :{
                    number:'{$Think.lang.ds_sort_number}',
                    min:'{$Think.lang.ds_min_error}0'
                },
                points_invite :{
                    number:'{$Think.lang.ds_sort_number}',
                    min:'{$Think.lang.ds_min_error}0'
                },
                points_rebate :{
                    number:'{$Think.lang.ds_sort_number}',
                    min:'{$Think.lang.ds_min_error}0'
                },
                points_orderrate :{
                    number:'{$Think.lang.ds_sort_number}',
                    min:'{$Think.lang.ds_min_error}0'
                },
                points_ordermax :{
                    number:'{$Think.lang.ds_sort_number}',
                    min:'{$Think.lang.ds_min_error}0'
                }
            }
        });

        $('#tijiao').click(function(){
              var invitation = $("#invitation").val();
              var purchase_goods = $("#purchase_goods").val();
              var service_balance = $("#service_balance").val();
              var service_invitation = $("#service_invitation").val();
            var service_money_radio = $("#service_money_radio").val();
              $.ajax({
                type: "POST",
                dataType: "json",
                url: "{:url('Basicsetup/setting')}",
                data:{"invitation":invitation,"purchase_goods":purchase_goods,"service_balance":service_balance,"service_invitation":service_invitation ,"service_money_radio":service_money_radio},
                success: function (data) {
                    console.log(data)
                    if (data.code == 100) {
                        layer.msg('保存成功');
                        location.reload();
                        // layer.msg(result.msg);
                        // location.href=result.url;return false;
                    }else{
                        layer.msg('保存失败');
                        location.reload();
                    }
                }
            })
        });
    });
</script>